layui.use(['form'], function() {
    let $ = layui.$;

    $("#get1").click(function () {
        let port =  $(this).text();
        $.ajax({
            dataType: 'json',
            url: config.gatewayUri + '/gc-biz/hello',
            success: function (result, status, xhr) {
                $("#result").html(JSON.stringify(result));
            },
            error: function(x) {
                console.log(x);
                layer.msg(JSON.stringify(x.responseJSON),  {icon: 6})
            }
        })
    });

    $("#post1").click(function () {
        $.ajax({
            dataType: 'json',
            type: 'post',
            url: config.gatewayUri + '/gc-biz/post1',
            data: {name: 't235', password: '123'},
            success: function (result, status, xhr) {
                $("#result").html(JSON.stringify(result));
            },
            error: function(x) {
                console.log(x);
                layer.msg(JSON.stringify(x.responseJSON),  {icon: 6})
            }
        })
    })

    $("#post2").click(function () {
        $.ajax({
            dataType: 'json',
            type: 'post',
            contentType: "application/json;charset=UTF-8",
            data: JSON.stringify({"userid":1}),
            url: config.gatewayUri + '/gc-biz/post2',
            success: function (result, status, xhr) {
                $("#result").html(JSON.stringify(result));
            },
            error: function(x) {
                console.log(x);
                layer.msg(JSON.stringify(x.responseJSON),  {icon: 6})
            }
        })
    })


})